package com.nida.route;

import java.util.HashMap;
import java.util.Map;

import com.nida.mvc.RequestMethod;

public class Routers {
    
    private Map<String, RouteHandler> routes = null;
    private Map<String, IntercepterHandler> interceptors = null;
    
    
    public Routers() {
        this.routes = new HashMap<>();
        this.interceptors = new HashMap<>();
    }

    public void addRoute(String path, RouteHandler handler, RequestMethod method) {
        String key = path + "#" + method.toString();
        //Class<?> controller = handler.getClass();
        routes.put(key, handler);
    }  

    public void addIntercepter(String path, IntercepterHandler handler, IntercepterType type) {
        String key = path + "#" + type.toString();
        //Class<?> controller = handler.getClass();
        interceptors.put(key, handler);
    }
    
    public Map<String,RouteHandler> getRoutes(){
        return this.routes;
    }
    
    public Map<String,IntercepterHandler> getInterceptors(){
        return this.interceptors;
    }
    
}
